package com.example.canteen.example;


import com.example.canteen.exeception.BizException;
import com.example.canteen.util.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

public class ExceptionController {

    @Api(tags = "异常测试例子")
    @Anonymous
    @RestController
    @RequestMapping("/api/exception")
    public class exceptionController {
        @ApiOperation("全局业务异常测试")
        @GetMapping("/test")
        public AjaxResult exception() {
            throw new BizException(404, "没找到");
        }

    }
}

